package com.usian.controller;

import com.usian.pojo.Student;
import com.usian.pojo.User;
import com.usian.service.UserService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.PathVariable;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;

import java.util.List;

@RestController
public class ProviderController {

    @Autowired
    private UserService userService;

    @RequestMapping("user/{id}")
    public User getUser(@PathVariable Integer id){
        return userService.getUser(id);
    }

    @RequestMapping("consumer/findAllStu")
    public List<Student> finAllStu(){
        return userService.findAllStu();
    }

    @RequestMapping("addStu")
    public void addStu(Student student){
        userService.addStu(student);
    }

}
